﻿namespace BloggerBackup
{
    using BloggerBackup.My;
    using BloggerBackup.My.Resources;
    using Google.GData.Client;
    using log4net;
    using log4net.Appender;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using PAB.Security;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.IO;
    using System.Net;
    using System.Runtime.CompilerServices;
    using System.Text;
    using System.Threading;
    using System.Windows.Forms;
    using System.Xml;

    [DesignerGenerated]
    public class MainForm : Form
    {
        private string $STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword;
        private StaticLocalInitFlag $STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword$Init;
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("AboutToolStripMenuItem")]
        private ToolStripMenuItem _AboutToolStripMenuItem;
        private AllSaveNameOptions _AllSaveOptions;
        [AccessedThroughProperty("BackupBackgroundWorker")]
        private BackgroundWorker _BackupBackgroundWorker;
        [AccessedThroughProperty("BackupPathFolderPicker")]
        private FolderPicker _BackupPathFolderPicker;
        [AccessedThroughProperty("BackupPostsButton")]
        private Button _BackupPostsButton;
        [AccessedThroughProperty("BlogInformationLabel")]
        private Label _BlogInformationLabel;
        [AccessedThroughProperty("BlogsComboBox")]
        private ComboBox _BlogsComboBox;
        [AccessedThroughProperty("CustomPathBuilderButton")]
        private Button _CustomPathBuilderButton;
        [AccessedThroughProperty("DownloadedStatusLabel")]
        private ToolStripStatusLabel _DownloadedStatusLabel;
        [AccessedThroughProperty("ExitToolStripMenuItem")]
        private ToolStripMenuItem _ExitToolStripMenuItem;
        [AccessedThroughProperty("FileToolStripMenuItem")]
        private ToolStripMenuItem _FileToolStripMenuItem;
        [AccessedThroughProperty("HelpToolStripMenuItem")]
        private ToolStripMenuItem _HelpToolStripMenuItem;
        [AccessedThroughProperty("Label10")]
        private Label _Label10;
        [AccessedThroughProperty("Label11")]
        private Label _Label11;
        [AccessedThroughProperty("Label12")]
        private Label _Label12;
        [AccessedThroughProperty("Label4")]
        private Label _Label4;
        [AccessedThroughProperty("Label5")]
        private Label _Label5;
        [AccessedThroughProperty("Label6")]
        private Label _Label6;
        [AccessedThroughProperty("Label8")]
        private Label _Label8;
        [AccessedThroughProperty("Label9")]
        private Label _Label9;
        [AccessedThroughProperty("LimitComboBox")]
        private ComboBox _LimitComboBox;
        [AccessedThroughProperty("MainStatusStrip")]
        private StatusStrip _MainStatusStrip;
        [AccessedThroughProperty("MaxEntriesComboBox")]
        private ComboBox _MaxEntriesComboBox;
        [AccessedThroughProperty("NewPostsSinceDatePicker")]
        private DateTimePicker _NewPostsSinceDatePicker;
        [AccessedThroughProperty("NewPostsSinceTimePicker")]
        private DateTimePicker _NewPostsSinceTimePicker;
        [AccessedThroughProperty("NewSettingsToolStripMenuItem")]
        private ToolStripMenuItem _NewSettingsToolStripMenuItem;
        [AccessedThroughProperty("OpenSettingsDialog")]
        private OpenFileDialog _OpenSettingsDialog;
        [AccessedThroughProperty("OpenSettingsToolStripMenuItem")]
        private ToolStripMenuItem _OpenSettingsToolStripMenuItem;
        [AccessedThroughProperty("OptionsToolStripMenuItem")]
        private ToolStripMenuItem _OptionsToolStripMenuItem;
        [AccessedThroughProperty("OverwriteCheckBox")]
        private CheckBox _OverwriteCheckBox;
        [AccessedThroughProperty("PrimaryMenuStrip")]
        private MenuStrip _PrimaryMenuStrip;
        [AccessedThroughProperty("RecentlyProcessedListBox")]
        private ListBox _RecentlyProcessedListBox;
        [AccessedThroughProperty("ReleaseHistoryToolStripMenuItem")]
        private ToolStripMenuItem _ReleaseHistoryToolStripMenuItem;
        [AccessedThroughProperty("RestoreBackgroundWorker")]
        private BackgroundWorker _RestoreBackgroundWorker;
        [AccessedThroughProperty("RestorePostsButton")]
        private Button _RestorePostsButton;
        [AccessedThroughProperty("SaveAsComboBox")]
        private ComboBox _SaveAsComboBox;
        [AccessedThroughProperty("SaveCommentsCheckBox")]
        private CheckBox _SaveCommentsCheckBox;
        [AccessedThroughProperty("SaveCommentsLabel")]
        private Label _SaveCommentsLabel;
        [AccessedThroughProperty("SaveSettingsAsToolStripMenuItem")]
        private ToolStripMenuItem _SaveSettingsAsToolStripMenuItem;
        [AccessedThroughProperty("SaveSettingsDialog")]
        private SaveFileDialog _SaveSettingsDialog;
        [AccessedThroughProperty("SaveSettingsToolStripMenuItem")]
        private ToolStripMenuItem _SaveSettingsToolStripMenuItem;
        private BlogSetting _SelectedBlogSetting;
        private Service _service;
        private BloggerBackupSettings _Settings;
        [AccessedThroughProperty("StatusLabel")]
        private ToolStripStatusLabel _StatusLabel;
        [AccessedThroughProperty("StopButton")]
        private Button _StopButton;
        private bool _StopProcessing;
        [AccessedThroughProperty("TableLayoutPanel1")]
        private TableLayoutPanel _TableLayoutPanel1;
        [AccessedThroughProperty("TableLayoutPanelBottom")]
        private TableLayoutPanel _TableLayoutPanelBottom;
        [AccessedThroughProperty("ToolsToolStripMenuItem")]
        private ToolStripMenuItem _ToolsToolStripMenuItem;
        [AccessedThroughProperty("ToolStripProgressBar1")]
        private ToolStripProgressBar _ToolStripProgressBar1;
        [AccessedThroughProperty("ToolStripSeparator1")]
        private ToolStripSeparator _ToolStripSeparator1;
        [AccessedThroughProperty("ToolStripSeparator2")]
        private ToolStripSeparator _ToolStripSeparator2;
        [AccessedThroughProperty("ToolStripSeparator3")]
        private ToolStripSeparator _ToolStripSeparator3;
        [AccessedThroughProperty("ToolStripSeparator4")]
        private ToolStripSeparator _ToolStripSeparator4;
        [AccessedThroughProperty("ViewLogsToolStripMenuItem")]
        private ToolStripMenuItem _ViewLogsToolStripMenuItem;
        private IContainer components;
        private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        public MainForm()
        {
            base.FormClosing += new FormClosingEventHandler(this.MainForm_FormClosing);
            base.Load += new EventHandler(this.MainForm_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this._AllSaveOptions = new AllSaveNameOptions();
            this._StopProcessing = false;
            this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword$Init = new StaticLocalInitFlag();
            this.InitializeComponent();
        }

        private void AboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutBox box = new AboutBox();
            box.ShowDialog(this);
            box.Dispose();
        }

        private void BackupBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorkerHelper argument = (BackgroundWorkerHelper) e.Argument;
            this.BackupPosts(argument.URL, argument.BackupPath, argument.NewPostsSince, argument.BlogTitle, argument.Blog);
        }

        private void BackupBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.TableLayoutPanelBottom.Enabled = true;
            this.BackupPostsButton.Enabled = true;
            this.RestorePostsButton.Enabled = true;
            this.StopButton.Enabled = false;
            this.ToolStripProgressBar1.Value = 0;
            this._service = null;
        }

        private void BackupPosts(string feedURL, string backupPath, DateTime postsSince, string blogTitle, BlogSetting Blog)
        {
            int batchProgress = 0;
            int maxEntries = 0;
            int batch = 0;
            int num5 = 0;
            bool flag = false;
            int downloaded = 0;
            AtomFeed feed2 = null;
            FeedQuery feedQuery = null;
            string path = "";
            FeedQuery query2 = new FeedQuery();
            query2.Uri = new Uri(feedURL);
            this.StatusUpdate("Determining batch size");
            if (this._SelectedBlogSetting.Limit <= 0)
            {
                query2.NumberToRetrieve = 0x19;
            }
            else if (this._SelectedBlogSetting.Limit < 0x19)
            {
                query2.NumberToRetrieve = this._SelectedBlogSetting.Limit;
            }
            else
            {
                query2.NumberToRetrieve = 0x19;
            }
            this.SetupBloggerService("", "");
            this.StatusUpdate("Issuing first query...");
            AtomFeed bloggerAtomFeed = null;
            string workingValue = "";
            if (Blog.RequiresLogIn && (this.DisplayLogin(this, ref Blog, ref workingValue) == DialogResult.OK))
            {
                this.SetupBloggerService(Blog.UserName, workingValue);
            }
            try
            {
                bloggerAtomFeed = this._service.Query(query2);
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                log.Error("Error getting data", exception);
                Interaction.MsgBox("Error getting data, " + exception.Message, MsgBoxStyle.OkOnly, null);
                ProjectData.ClearProjectError();
            }
            if ((((bloggerAtomFeed == null) || (bloggerAtomFeed.TotalResults == 0)) ? 1 : 0) != 0)
            {
                this.StatusUpdate("Error getting posts or no posts found.");
                switch (((int) Interaction.MsgBox("Ran into an issue getting the posts... Would you like to log into Blogger and try again?", MsgBoxStyle.YesNo, "Unable to get posts")))
                {
                    case 6:
                        if (this.DisplayLogin(this, ref Blog, ref workingValue) != DialogResult.OK)
                        {
                            return;
                        }
                        this.SetupBloggerService(Blog.UserName, workingValue);
                        try
                        {
                            bloggerAtomFeed = this._service.Query(query2);
                        }
                        catch (Exception exception7)
                        {
                            ProjectData.SetProjectError(exception7);
                            Exception exception2 = exception7;
                            log.Error("Error getting data", exception2);
                            Interaction.MsgBox("Error getting data, " + exception2.Message, MsgBoxStyle.OkOnly, null);
                            ProjectData.ClearProjectError();
                        }
                        break;

                    case 7:
                        return;
                }
            }
            this.StatusUpdate("Creating backup folder...");
            if (!Directory.Exists(backupPath))
            {
                try
                {
                    Directory.CreateDirectory(backupPath);
                }
                catch (Exception exception8)
                {
                    ProjectData.SetProjectError(exception8);
                    Exception exception3 = exception8;
                    log.Error("Error creating backup path", exception3);
                    Interaction.MsgBox("Error creating backup path, " + exception3.Message, MsgBoxStyle.OkOnly, null);
                    ProjectData.ClearProjectError();
                }
            }
            XmlTextWriter writer = null;
            this.StatusUpdate("Setting up output file...");
            if (this._SelectedBlogSetting.SaveFormat == 1)
            {
                path = "";
                if (this._SelectedBlogSetting.MaxEntries == 0)
                {
                    writer = this.StartSingleAtomXML(backupPath, bloggerAtomFeed, 0);
                }
                else
                {
                    writer = this.StartSingleAtomXML(backupPath, bloggerAtomFeed, 1);
                    maxEntries = this._SelectedBlogSetting.MaxEntries;
                    batch = 1;
                }
            }
            if (bloggerAtomFeed != null)
            {
                DateTime updated = new DateTime();
                if (bloggerAtomFeed.Entries.Count > 0)
                {
                    updated = bloggerAtomFeed.Entries[0].Updated;
                    this._SelectedBlogSetting.NewestPostDate = updated;
                    this.StatusUpdate("The newest post for this blog is " + updated.ToString());
                }
            }
            goto Label_0A58;
        Label_0886:
            this.TotalDownloaded(downloaded);
            if (bloggerAtomFeed.NextChunk == null)
            {
                if ((((this._SelectedBlogSetting.Limit > 0) && (downloaded >= this._SelectedBlogSetting.Limit)) ? 1 : 0) != 0)
                {
                    bloggerAtomFeed = null;
                }
                else if (batchProgress < query2.NumberToRetrieve)
                {
                    bloggerAtomFeed = null;
                }
                else
                {
                    bloggerAtomFeed = null;
                }
            }
            else if ((((this._SelectedBlogSetting.Limit > 0) && (downloaded >= this._SelectedBlogSetting.Limit)) ? 1 : 0) != 0)
            {
                bloggerAtomFeed = null;
            }
            else if (batchProgress < query2.NumberToRetrieve)
            {
                bloggerAtomFeed = null;
            }
            else
            {
                query2.Uri = new Uri(bloggerAtomFeed.NextChunk);
                batchProgress = 0;
                this.StatusUpdate("Getting next chunk, " + downloaded.ToString() + " saved so far");
                num5 = 0;
                flag = false;
                while (num5 < 10)
                {
                    Thread.Sleep(0x3e8);
                    try
                    {
                        bloggerAtomFeed = this._service.Query(query2);
                        flag = true;
                        break;
                    }
                    catch (Exception exception11)
                    {
                        ProjectData.SetProjectError(exception11);
                        Exception exception6 = exception11;
                        log.Error("Error Getting Next Chunk", exception6);
                        this.StatusUpdate("Error getting next chunk, retrying (" + num5.ToString() + ")");
                        num5++;
                        Thread.Sleep(0x7d0);
                        ProjectData.ClearProjectError();
                    }
                    if (this.BackupBackgroundWorker.CancellationPending)
                    {
                        goto Label_0A83;
                    }
                }
                if (!flag)
                {
                    Interaction.MsgBox("There were errors when trying to get the next chunk of data. Ever after retrying " + num5.ToString() + " times the data could not be downloaded. Please try again later", MsgBoxStyle.OkOnly, null);
                    this.StatusUpdate("There were errors when trying to get the next chunk of data. Ever after retrying " + num5.ToString() + " times the data could not be downloaded. Please try again later");
                    goto Label_0A83;
                }
            }
        Label_0A58:;
            if ((((!this.BackupBackgroundWorker.CancellationPending && (bloggerAtomFeed != null)) && (bloggerAtomFeed.Entries.Count > 0)) ? 1 : 0) != 0)
            {
                IEnumerator enumerator;
                this.StatusUpdate("Processing batch of " + bloggerAtomFeed.Entries.Count.ToString() + " posts");
                path = "";
                if ((this._SelectedBlogSetting.MaxEntries > 0) & (maxEntries <= 0))
                {
                    batch++;
                    writer.WriteEndElement();
                    writer.WriteEndDocument();
                    writer.Flush();
                    writer.Close();
                    writer = this.StartSingleAtomXML(backupPath, bloggerAtomFeed, batch);
                    maxEntries = this._SelectedBlogSetting.MaxEntries;
                }
                try
                {
                    enumerator = bloggerAtomFeed.Entries.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DateTime time;
                        AtomEntry current = (AtomEntry) enumerator.Current;
                        DateTime.TryParse(current.Updated.ToString(), out time);
                        if (DateTime.Compare(time, postsSince) <= 0)
                        {
                            goto Label_0A83;
                        }
                        this.StatusUpdate("Saving post " + current.Title.Text);
                        string originalName = "";
                        string str3 = "";
                        if (writer == null)
                        {
                            MemoryStream stream = new MemoryStream();
                            current.SaveToXml(stream);
                            str3 = this._Settings.DefaultSaveNameOptions.GetPath(blogTitle, backupPath, stream);
                            if (!Directory.Exists(str3))
                            {
                                try
                                {
                                    Directory.CreateDirectory(str3);
                                }
                                catch (Exception exception9)
                                {
                                    ProjectData.SetProjectError(exception9);
                                    Exception exception4 = exception9;
                                    log.Error("Error creating backup path " + str3, exception4);
                                    Interaction.MsgBox("Error creating backup path, " + exception4.Message, MsgBoxStyle.OkOnly, null);
                                    ProjectData.ClearProjectError();
                                }
                            }
                            originalName = this._Settings.DefaultSaveNameOptions.GetPostFileName(stream);
                            path = this.GetSafeSaveFileName(str3, originalName, "xml", this._SelectedBlogSetting.OverwriteExisting);
                            stream.Close();
                            stream.Dispose();
                            using (FileStream stream2 = new FileStream(path, FileMode.CreateNew))
                            {
                                current.SaveToXml(stream2);
                            }
                            System.IO.File.SetCreationTime(path, current.Published);
                            System.IO.File.SetLastWriteTime(path, current.Updated);
                        }
                        else
                        {
                            current.SaveToXml(writer);
                        }
                        if (this._SelectedBlogSetting.SaveComments)
                        {
                            IEnumerator enumerator2;
                            try
                            {
                                enumerator2 = current.Links.GetEnumerator();
                                while (enumerator2.MoveNext())
                                {
                                    AtomLink link = (AtomLink) enumerator2.Current;
                                    if (this.BackupBackgroundWorker.CancellationPending)
                                    {
                                        goto Label_07C3;
                                    }
                                    if (link.Rel == "self")
                                    {
                                        string baseUri = (link.HRef.ToString().Replace("/feeds/posts/default/", "/feeds/") + "/comments/default").Replace("/posts/default/", "/");
                                        feedQuery = new FeedQuery(baseUri);
                                        feedQuery.Uri = new Uri(baseUri);
                                        feedQuery.NumberToRetrieve = 0;
                                        this.StatusUpdate("Getting comments");
                                        num5 = 0;
                                        while (num5 < 10)
                                        {
                                            if (this.BackupBackgroundWorker.CancellationPending)
                                            {
                                                goto Label_0A83;
                                            }
                                            try
                                            {
                                                feed2 = this._service.Query(feedQuery);
                                                break;
                                            }
                                            catch (Exception exception10)
                                            {
                                                ProjectData.SetProjectError(exception10);
                                                Exception exception5 = exception10;
                                                log.Error("Error looking for comments", exception5);
                                                this.StatusUpdate("Error looking for comments, retrying (" + num5.ToString() + ")");
                                                num5++;
                                                Thread.Sleep(500);
                                                ProjectData.ClearProjectError();
                                            }
                                        }
                                        if ((((feed2 != null) && (feed2.Entries.Count > 0)) ? 1 : 0) != 0)
                                        {
                                            string str6 = this.GetSafeSaveFileName(str3, originalName, "comments.xml", this._SelectedBlogSetting.OverwriteExisting);
                                            this.StatusUpdate("Saving comments");
                                            using (FileStream stream3 = new FileStream(str6, FileMode.CreateNew))
                                            {
                                                feed2.SaveToXml(stream3);
                                            }
                                            if (System.IO.File.Exists(str6))
                                            {
                                                System.IO.File.SetCreationTime(str6, current.Published);
                                                System.IO.File.SetLastWriteTime(str6, current.Updated);
                                            }
                                        }
                                        goto Label_07C3;
                                        feedQuery = null;
                                        feed2 = null;
                                    }
                                }
                            }
                            finally
                            {
                                if (enumerator2 is IDisposable)
                                {
                                    (enumerator2 as IDisposable).Dispose();
                                }
                            }
                        }
                    Label_07C3:
                        downloaded++;
                        batchProgress++;
                        maxEntries--;
                        this.ProgressUpdate(query2.NumberToRetrieve, batchProgress, current.Title.Text, path);
                        if (this.BackupBackgroundWorker.CancellationPending)
                        {
                            goto Label_0A83;
                        }
                        if (((((this._SelectedBlogSetting.Limit > 0) && (this._SelectedBlogSetting.Limit < 0x19)) ? 1 : 0) != 0) && (downloaded >= this._SelectedBlogSetting.Limit))
                        {
                            goto Label_0886;
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                goto Label_0886;
            }
        Label_0A83:
            if (writer != null)
            {
                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();
            }
            this.StatusUpdate("Done");
        }

        private void BackupPostsButton_Click(object sender, EventArgs e)
        {
            if (this.BlogsComboBox.SelectedIndex != -1)
            {
                DateTime time;
                if (this.NewPostsSinceDatePicker.Checked)
                {
                    if (!DateTime.TryParse(this.NewPostsSinceDatePicker.Value.ToShortDateString() + " " + this.NewPostsSinceTimePicker.Value.ToLongTimeString(), out time))
                    {
                        Interaction.MsgBox("Unable to setup the New Posts Since date. Please check the date/time values and try again", MsgBoxStyle.OkOnly, null);
                        return;
                    }
                }
                else
                {
                    time = new DateTime(0x851055320574000L);
                }
                BlogSetting selectedItem = (BlogSetting) this.BlogsComboBox.SelectedItem;
                this.TableLayoutPanelBottom.Enabled = false;
                this.BackupPostsButton.Enabled = false;
                this.RestorePostsButton.Enabled = false;
                this.StopButton.Enabled = true;
                this.RecentlyProcessedListBox.Items.Clear();
                this.StatusUpdate("Starting background processing...");
                this.TotalDownloaded(-1);
                string selectedPath = this.BackupPathFolderPicker.SelectedPath;
                string url = "";
                if ((((selectedItem.PostURL != null) && (selectedItem.PostURL.Length > 0)) ? 1 : 0) != 0)
                {
                    url = selectedItem.PostURL;
                }
                else
                {
                    url = selectedItem.FeedURL;
                }
                this._Settings.LastUsedBlog = selectedItem;
                this.BackupBackgroundWorker.RunWorkerAsync(new BackgroundWorkerHelper(url, selectedPath, time, selectedItem.Title, selectedItem));
            }
        }

        private void BlogsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            IEnumerator enumerator;
            IEnumerator enumerator2;
            IEnumerator enumerator3;
            if (this.BlogsComboBox.SelectedIndex <= -1)
            {
                this.BackupPostsButton.Enabled = false;
                this.RestorePostsButton.Enabled = false;
                this.TableLayoutPanelBottom.Enabled = false;
                this.SaveCommentsLabel.Enabled = false;
                this.SaveCommentsCheckBox.Enabled = false;
                this._Settings.LastUsedBlog = null;
                this.BlogInformationLabel.Text = "";
                this.NewPostsSinceDatePicker.Value = new DateTime(0x851055320574000L);
                this.NewPostsSinceTimePicker.Value = new DateTime(0x851055320574000L);
                this.NewPostsSinceDatePicker.Checked = false;
                this.OverwriteCheckBox.Checked = false;
                this.LimitComboBox.SelectedIndex = -1;
                this.SaveAsComboBox.SelectedIndex = -1;
                this.MaxEntriesComboBox.SelectedIndex = -1;
                return;
            }
            if (this.BlogsComboBox.SelectedIndex == 0)
            {
                this.BackupPostsButton.Enabled = false;
                this.RestorePostsButton.Enabled = false;
                this.TableLayoutPanelBottom.Enabled = false;
                this.SaveCommentsLabel.Enabled = false;
                this.SaveCommentsCheckBox.Enabled = false;
                this.BlogsComboBox.SelectedIndex = -1;
                this.MaintainBlogList();
                return;
            }
            this.BackupPostsButton.Enabled = true;
            this.RestorePostsButton.Enabled = true;
            this._SelectedBlogSetting = (BlogSetting) this.BlogsComboBox.SelectedItem;
            this._Settings.LastUsedBlog = this._SelectedBlogSetting;
            this.BlogInformationLabel.Text = this._SelectedBlogSetting.Title + "\r\nURL: " + this._SelectedBlogSetting.BlogURL + "\r\nPublic Feed: " + this._SelectedBlogSetting.FeedURL + "\r\nPost URL: " + this._SelectedBlogSetting.PostURL;
            this.TableLayoutPanelBottom.Enabled = true;
            this.SaveCommentsLabel.Enabled = true;
            this.SaveCommentsCheckBox.Enabled = true;
            if (this._SelectedBlogSetting.NewestPostDate.Year < 0x76c)
            {
                this._SelectedBlogSetting.NewestPostDate = new DateTime(0x851055320574000L);
            }
            this.NewPostsSinceDatePicker.Value = this._SelectedBlogSetting.NewestPostDate;
            this.NewPostsSinceTimePicker.Value = this._SelectedBlogSetting.NewestPostDate;
            this.NewPostsSinceDatePicker.Checked = this._SelectedBlogSetting.OnlyNewPostsSince;
            if (this.NewPostsSinceDatePicker.Checked)
            {
                this.NewPostsSinceTimePicker.Enabled = true;
            }
            else
            {
                this.NewPostsSinceTimePicker.Enabled = false;
            }
            try
            {
                enumerator = this.LimitComboBox.Items.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    object objectValue = RuntimeHelpers.GetObjectValue(enumerator.Current);
                    if (((LimitComboBoxItem) objectValue).Limit == this._SelectedBlogSetting.Limit)
                    {
                        this.LimitComboBox.SelectedItem = RuntimeHelpers.GetObjectValue(objectValue);
                        goto Label_029B;
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
        Label_029B:;
            try
            {
                enumerator2 = this.SaveAsComboBox.Items.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    object obj3 = RuntimeHelpers.GetObjectValue(enumerator2.Current);
                    if (((SaveAsComboBoxItem) obj3).SaveAsFormat == this._SelectedBlogSetting.SaveFormat)
                    {
                        this.SaveAsComboBox.SelectedItem = RuntimeHelpers.GetObjectValue(obj3);
                        goto Label_0324;
                    }
                }
            }
            finally
            {
                if (enumerator2 is IDisposable)
                {
                    (enumerator2 as IDisposable).Dispose();
                }
            }
        Label_0324:;
            try
            {
                enumerator3 = this.MaxEntriesComboBox.Items.GetEnumerator();
                while (enumerator3.MoveNext())
                {
                    object obj4 = RuntimeHelpers.GetObjectValue(enumerator3.Current);
                    if (((LimitComboBoxItem) obj4).Limit == this._SelectedBlogSetting.MaxEntries)
                    {
                        this.MaxEntriesComboBox.SelectedItem = RuntimeHelpers.GetObjectValue(obj4);
                        goto Label_03AD;
                    }
                }
            }
            finally
            {
                if (enumerator3 is IDisposable)
                {
                    (enumerator3 as IDisposable).Dispose();
                }
            }
        Label_03AD:
            this.OverwriteCheckBox.Checked = this._SelectedBlogSetting.OverwriteExisting;
            this.SaveCommentsCheckBox.Checked = this._SelectedBlogSetting.SaveComments;
        }

        private bool ChangeLogFilename(string appenderName, string newFilename)
        {
            foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
            {
                if ((((appender.Name.CompareTo(appenderName) == 0) && (appender is FileAppender)) ? 1 : 0) != 0)
                {
                    FileAppender appender2 = (FileAppender) appender;
                    appender2.File = newFilename;
                    appender2.ActivateOptions();
                    return true;
                }
            }
            return false;
        }

        private void CustomPathBuilderButton_Click(object sender, EventArgs e)
        {
            log.Info("CustomPathBuilderButton_Click Start");
            PathBuilderForm form = null;
            try
            {
                form = new PathBuilderForm();
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                log.Error("Error Creating new Path Builder Form", exception);
                Interaction.MsgBox("Error creating Path Builder dialog\r\n\r\n" + exception.Message, MsgBoxStyle.OkOnly, null);
                ProjectData.ClearProjectError();
            }
            if (form != null)
            {
                string backupPath = "";
                try
                {
                    backupPath = this.BackupPathFolderPicker.SelectedPath;
                }
                catch (Exception exception5)
                {
                    ProjectData.SetProjectError(exception5);
                    Exception exception2 = exception5;
                    log.Error("Error getting BackupPathFolderPicker.SelectedPath", exception2);
                    Interaction.MsgBox("Error in BackupPathFolderPicker. \r\n\r\n" + exception2.Message, MsgBoxStyle.OkOnly, "Error");
                    ProjectData.ClearProjectError();
                }
                if (backupPath.Length == 0)
                {
                    try
                    {
                        backupPath = Path.Combine(MyProject.Computer.FileSystem.SpecialDirectories.MyDocuments, "Blogger Backup");
                    }
                    catch (Exception exception6)
                    {
                        ProjectData.SetProjectError(exception6);
                        Exception exception3 = exception6;
                        log.Error("Error using IO.Path.Combine", exception3);
                        Interaction.MsgBox("Error using IO.Path.Combine. \r\n\r\n" + exception3.Message, MsgBoxStyle.OkOnly, "Error");
                        ProjectData.ClearProjectError();
                    }
                }
                log.Info("Before BuildPath.ShowDialog");
                try
                {
                    if (form.ShowDialog(this, this._AllSaveOptions, this._Settings.DefaultSaveNameOptions, "Sample Title", backupPath, log) == DialogResult.OK)
                    {
                    }
                }
                catch (Exception exception7)
                {
                    ProjectData.SetProjectError(exception7);
                    Exception exception4 = exception7;
                    log.Error("Error in BuildPath.ShowDialog", exception4);
                    Interaction.MsgBox("Error in BuildPath.ShowDialog. \r\n\r\n" + exception4.Message, MsgBoxStyle.OkOnly, "Error");
                    ProjectData.ClearProjectError();
                }
                log.Info("CustomPathBuilderButton_Click End");
            }
        }

        private DialogResult DisplayLogin(IWin32Window owner, ref BlogSetting Blog, ref string WorkingValue)
        {
            Monitor.Enter(this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword$Init);
            try
            {
                if (this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword$Init.State == 0)
                {
                    this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword$Init.State = 2;
                    this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword = "";
                }
                else if (this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword$Init.State == 2)
                {
                    throw new IncompleteInitialization();
                }
            }
            finally
            {
                this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword$Init.State = 1;
                Monitor.Exit(this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword$Init);
            }
            this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword = WorkingValue;
            if (this.InvokeRequired)
            {
                DisplayLoginDelegate method = new DisplayLoginDelegate(this.DisplayLogin);
                object objectValue = RuntimeHelpers.GetObjectValue(this.Invoke(method, new object[] { owner, Blog, this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword }));
                WorkingValue = this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword;
                return (DialogResult) Conversions.ToInteger(objectValue);
            }
            DialogResult result2 = new LoginDialog().ShowDialog(owner, ref Blog, ref this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword);
            if (result2 == DialogResult.OK)
            {
                WorkingValue = this.$STATIC$DisplayLogin$2031180E91280ED10122410E$sPassword;
            }
            return result2;
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (((disposing && (this.components != null)) ? 1 : 0) != 0)
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private string GetSafeSaveFileName(string Folder, string OriginalName, string Extension, bool OverwriteExisting)
        {
            string str3 = OriginalName;
            char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
            int num = 1;
            foreach (char ch in invalidFileNameChars)
            {
                str3 = str3.Replace(Conversions.ToString(ch), "_");
            }
            string path = Path.Combine(Folder, str3 + "." + Extension);
            if (path.Length > 250)
            {
                str3 = Strings.Left(str3, (250 - Extension.Length) - Folder.Length);
                path = Path.Combine(Folder, str3 + "." + Extension);
            }
            if (((System.IO.File.Exists(path) && OverwriteExisting) ? 1 : 0) != 0)
            {
                this.StatusUpdate("Overwriting existing file " + str3);
                System.IO.File.Delete(path);
                return path;
            }
            while (System.IO.File.Exists(path))
            {
                this.StatusUpdate("Attempting to get a unique name for " + str3 + "(" + num.ToString() + ")");
                path = Path.Combine(Folder, str3 + "." + num.ToString("0000") + "." + Extension);
                num++;
            }
            return path;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(MainForm));
            this.BackupPostsButton = new Button();
            this.Label5 = new Label();
            this.Label6 = new Label();
            this.StopButton = new Button();
            this.OverwriteCheckBox = new CheckBox();
            this.BackupBackgroundWorker = new BackgroundWorker();
            this.MainStatusStrip = new StatusStrip();
            this.ToolStripProgressBar1 = new ToolStripProgressBar();
            this.StatusLabel = new ToolStripStatusLabel();
            this.DownloadedStatusLabel = new ToolStripStatusLabel();
            this.TableLayoutPanelBottom = new TableLayoutPanel();
            this.Label12 = new Label();
            this.BackupPathFolderPicker = new FolderPicker();
            this.Label9 = new Label();
            this.SaveCommentsCheckBox = new CheckBox();
            this.SaveCommentsLabel = new Label();
            this.SaveAsComboBox = new ComboBox();
            this.LimitComboBox = new ComboBox();
            this.Label10 = new Label();
            this.TableLayoutPanel1 = new TableLayoutPanel();
            this.NewPostsSinceTimePicker = new DateTimePicker();
            this.NewPostsSinceDatePicker = new DateTimePicker();
            this.CustomPathBuilderButton = new Button();
            this.MaxEntriesComboBox = new ComboBox();
            this.Label11 = new Label();
            this.RecentlyProcessedListBox = new ListBox();
            this.Label8 = new Label();
            this.PrimaryMenuStrip = new MenuStrip();
            this.FileToolStripMenuItem = new ToolStripMenuItem();
            this.NewSettingsToolStripMenuItem = new ToolStripMenuItem();
            this.ToolStripSeparator3 = new ToolStripSeparator();
            this.OpenSettingsToolStripMenuItem = new ToolStripMenuItem();
            this.ToolStripSeparator2 = new ToolStripSeparator();
            this.SaveSettingsToolStripMenuItem = new ToolStripMenuItem();
            this.SaveSettingsAsToolStripMenuItem = new ToolStripMenuItem();
            this.ToolStripSeparator1 = new ToolStripSeparator();
            this.ExitToolStripMenuItem = new ToolStripMenuItem();
            this.ToolsToolStripMenuItem = new ToolStripMenuItem();
            this.OptionsToolStripMenuItem = new ToolStripMenuItem();
            this.HelpToolStripMenuItem = new ToolStripMenuItem();
            this.ViewLogsToolStripMenuItem = new ToolStripMenuItem();
            this.ReleaseHistoryToolStripMenuItem = new ToolStripMenuItem();
            this.ToolStripSeparator4 = new ToolStripSeparator();
            this.AboutToolStripMenuItem = new ToolStripMenuItem();
            this.RestorePostsButton = new Button();
            this.RestoreBackgroundWorker = new BackgroundWorker();
            this.OpenSettingsDialog = new OpenFileDialog();
            this.SaveSettingsDialog = new SaveFileDialog();
            this.Label4 = new Label();
            this.BlogsComboBox = new ComboBox();
            this.BlogInformationLabel = new Label();
            this.MainStatusStrip.SuspendLayout();
            this.TableLayoutPanelBottom.SuspendLayout();
            this.TableLayoutPanel1.SuspendLayout();
            this.PrimaryMenuStrip.SuspendLayout();
            this.SuspendLayout();
            this.BackupPostsButton.Enabled = false;
            Point point = new Point(0xc2, 0x159);
            this.BackupPostsButton.Location = point;
            this.BackupPostsButton.Name = "BackupPostsButton";
            Size size = new Size(0x56, 0x19);
            this.BackupPostsButton.Size = size;
            this.BackupPostsButton.TabIndex = 2;
            this.BackupPostsButton.Text = "Backup Posts";
            this.BackupPostsButton.UseVisualStyleBackColor = true;
            this.Label5.AutoSize = true;
            point = new Point(3, 0);
            this.Label5.Location = point;
            this.Label5.Name = "Label5";
            size = new Size(0x68, 13);
            this.Label5.Size = size;
            this.Label5.TabIndex = 2;
            this.Label5.Text = "Save posts to folder:";
            this.Label6.AutoSize = true;
            point = new Point(3, 0x94);
            this.Label6.Location = point;
            this.Label6.Name = "Label6";
            size = new Size(0x7d, 13);
            this.Label6.Size = size;
            this.Label6.TabIndex = 14;
            this.Label6.Text = "Get only the most recent:";
            this.StopButton.Enabled = false;
            point = new Point(0x11e, 0x159);
            this.StopButton.Location = point;
            this.StopButton.Name = "StopButton";
            size = new Size(0x56, 0x19);
            this.StopButton.Size = size;
            this.StopButton.TabIndex = 3;
            this.StopButton.Text = "Stop";
            this.StopButton.UseVisualStyleBackColor = true;
            this.OverwriteCheckBox.AutoSize = true;
            point = new Point(150, 0x39);
            this.OverwriteCheckBox.Location = point;
            this.OverwriteCheckBox.Name = "OverwriteCheckBox";
            size = new Size(15, 14);
            this.OverwriteCheckBox.Size = size;
            this.OverwriteCheckBox.TabIndex = 7;
            this.OverwriteCheckBox.UseVisualStyleBackColor = true;
            this.BackupBackgroundWorker.WorkerReportsProgress = true;
            this.BackupBackgroundWorker.WorkerSupportsCancellation = true;
            this.MainStatusStrip.Items.AddRange(new ToolStripItem[] { this.ToolStripProgressBar1, this.StatusLabel, this.DownloadedStatusLabel });
            point = new Point(0, 0x180);
            this.MainStatusStrip.Location = point;
            this.MainStatusStrip.Name = "MainStatusStrip";
            size = new Size(0x2c5, 0x16);
            this.MainStatusStrip.Size = size;
            this.MainStatusStrip.TabIndex = 0x19;
            this.MainStatusStrip.Text = "StatusStrip1";
            this.ToolStripProgressBar1.Name = "ToolStripProgressBar1";
            size = new Size(200, 0x10);
            this.ToolStripProgressBar1.Size = size;
            this.StatusLabel.Name = "StatusLabel";
            size = new Size(0x1ec, 0x11);
            this.StatusLabel.Size = size;
            this.StatusLabel.Spring = true;
            this.StatusLabel.TextAlign = ContentAlignment.TopLeft;
            this.DownloadedStatusLabel.Name = "DownloadedStatusLabel";
            size = new Size(0, 0x11);
            this.DownloadedStatusLabel.Size = size;
            this.TableLayoutPanelBottom.ColumnCount = 2;
            this.TableLayoutPanelBottom.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 147f));
            this.TableLayoutPanelBottom.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
            this.TableLayoutPanelBottom.Controls.Add(this.Label12, 0, 7);
            this.TableLayoutPanelBottom.Controls.Add(this.BackupPathFolderPicker, 1, 0);
            this.TableLayoutPanelBottom.Controls.Add(this.OverwriteCheckBox, 1, 2);
            this.TableLayoutPanelBottom.Controls.Add(this.Label9, 0, 2);
            this.TableLayoutPanelBottom.Controls.Add(this.SaveCommentsCheckBox, 1, 3);
            this.TableLayoutPanelBottom.Controls.Add(this.SaveCommentsLabel, 0, 3);
            this.TableLayoutPanelBottom.Controls.Add(this.SaveAsComboBox, 1, 4);
            this.TableLayoutPanelBottom.Controls.Add(this.LimitComboBox, 1, 6);
            this.TableLayoutPanelBottom.Controls.Add(this.Label6, 0, 6);
            this.TableLayoutPanelBottom.Controls.Add(this.Label10, 0, 4);
            this.TableLayoutPanelBottom.Controls.Add(this.TableLayoutPanel1, 2, 7);
            this.TableLayoutPanelBottom.Controls.Add(this.CustomPathBuilderButton, 1, 1);
            this.TableLayoutPanelBottom.Controls.Add(this.MaxEntriesComboBox, 1, 5);
            this.TableLayoutPanelBottom.Controls.Add(this.Label11, 0, 5);
            this.TableLayoutPanelBottom.Controls.Add(this.Label5, 0, 0);
            this.TableLayoutPanelBottom.Enabled = false;
            point = new Point(6, 0x86);
            this.TableLayoutPanelBottom.Location = point;
            this.TableLayoutPanelBottom.Name = "TableLayoutPanelBottom";
            this.TableLayoutPanelBottom.RowCount = 8;
            this.TableLayoutPanelBottom.RowStyles.Add(new RowStyle(SizeType.Absolute, 26f));
            this.TableLayoutPanelBottom.RowStyles.Add(new RowStyle());
            this.TableLayoutPanelBottom.RowStyles.Add(new RowStyle());
            this.TableLayoutPanelBottom.RowStyles.Add(new RowStyle());
            this.TableLayoutPanelBottom.RowStyles.Add(new RowStyle());
            this.TableLayoutPanelBottom.RowStyles.Add(new RowStyle());
            this.TableLayoutPanelBottom.RowStyles.Add(new RowStyle(SizeType.Absolute, 26f));
            this.TableLayoutPanelBottom.RowStyles.Add(new RowStyle());
            size = new Size(0x16e, 0xcd);
            this.TableLayoutPanelBottom.Size = size;
            this.TableLayoutPanelBottom.TabIndex = 1;
            this.Label12.AutoSize = true;
            point = new Point(3, 0xae);
            this.Label12.Location = point;
            this.Label12.Name = "Label12";
            size = new Size(110, 13);
            this.Label12.Size = size;
            this.Label12.TabIndex = 0x10;
            this.Label12.Text = "Only new posts since:";
            this.BackupPathFolderPicker.Dock = DockStyle.Fill;
            point = new Point(150, 3);
            this.BackupPathFolderPicker.Location = point;
            this.BackupPathFolderPicker.Name = "BackupPathFolderPicker";
            size = new Size(0xd5, 20);
            this.BackupPathFolderPicker.Size = size;
            this.BackupPathFolderPicker.TabIndex = 3;
            this.Label9.AutoSize = true;
            point = new Point(3, 0x36);
            this.Label9.Location = point;
            this.Label9.Name = "Label9";
            size = new Size(140, 13);
            this.Label9.Size = size;
            this.Label9.TabIndex = 6;
            this.Label9.Text = "Overwrite existing backups?";
            this.SaveCommentsCheckBox.AutoSize = true;
            this.SaveCommentsCheckBox.Enabled = false;
            point = new Point(150, 0x4d);
            this.SaveCommentsCheckBox.Location = point;
            this.SaveCommentsCheckBox.Name = "SaveCommentsCheckBox";
            size = new Size(15, 14);
            this.SaveCommentsCheckBox.Size = size;
            this.SaveCommentsCheckBox.TabIndex = 9;
            this.SaveCommentsCheckBox.UseVisualStyleBackColor = true;
            this.SaveCommentsLabel.AutoSize = true;
            this.SaveCommentsLabel.Enabled = false;
            point = new Point(3, 0x4a);
            this.SaveCommentsLabel.Location = point;
            this.SaveCommentsLabel.Name = "SaveCommentsLabel";
            size = new Size(0x59, 13);
            this.SaveCommentsLabel.Size = size;
            this.SaveCommentsLabel.TabIndex = 8;
            this.SaveCommentsLabel.Text = "Save comments?";
            this.SaveAsComboBox.Dock = DockStyle.Fill;
            this.SaveAsComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            this.SaveAsComboBox.FormattingEnabled = true;
            this.SaveAsComboBox.Items.AddRange(new object[] { "No Limit, Get All Posts", "100", "50", "25", "10" });
            point = new Point(150, 0x61);
            this.SaveAsComboBox.Location = point;
            this.SaveAsComboBox.Name = "SaveAsComboBox";
            size = new Size(0xd5, 0x15);
            this.SaveAsComboBox.Size = size;
            this.SaveAsComboBox.TabIndex = 11;
            this.LimitComboBox.Dock = DockStyle.Fill;
            this.LimitComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            this.LimitComboBox.FormattingEnabled = true;
            this.LimitComboBox.Items.AddRange(new object[] { "No Limit, Get All Posts", "100", "50", "25", "10" });
            point = new Point(150, 0x97);
            this.LimitComboBox.Location = point;
            this.LimitComboBox.Name = "LimitComboBox";
            size = new Size(0xd5, 0x15);
            this.LimitComboBox.Size = size;
            this.LimitComboBox.TabIndex = 15;
            this.Label10.AutoSize = true;
            point = new Point(3, 0x5e);
            this.Label10.Location = point;
            this.Label10.Name = "Label10";
            size = new Size(0x73, 13);
            this.Label10.Size = size;
            this.Label10.TabIndex = 10;
            this.Label10.Text = "Save posts as (format):";
            this.TableLayoutPanel1.ColumnCount = 2;
            this.TableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 54.3379f));
            this.TableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 45.6621f));
            this.TableLayoutPanel1.Controls.Add(this.NewPostsSinceTimePicker, 1, 0);
            this.TableLayoutPanel1.Controls.Add(this.NewPostsSinceDatePicker, 0, 0);
            this.TableLayoutPanel1.Dock = DockStyle.Fill;
            point = new Point(0x93, 0xae);
            this.TableLayoutPanel1.Location = point;
            Padding padding = new Padding(0);
            this.TableLayoutPanel1.Margin = padding;
            this.TableLayoutPanel1.Name = "TableLayoutPanel1";
            this.TableLayoutPanel1.RowCount = 1;
            this.TableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 50f));
            size = new Size(0xdb, 0x1f);
            this.TableLayoutPanel1.Size = size;
            this.TableLayoutPanel1.TabIndex = 20;
            this.NewPostsSinceTimePicker.CustomFormat = "";
            this.NewPostsSinceTimePicker.Dock = DockStyle.Top;
            this.NewPostsSinceTimePicker.Enabled = false;
            this.NewPostsSinceTimePicker.Format = DateTimePickerFormat.Time;
            point = new Point(0x79, 3);
            this.NewPostsSinceTimePicker.Location = point;
            this.NewPostsSinceTimePicker.Name = "NewPostsSinceTimePicker";
            this.NewPostsSinceTimePicker.ShowUpDown = true;
            size = new Size(0x5f, 20);
            this.NewPostsSinceTimePicker.Size = size;
            this.NewPostsSinceTimePicker.TabIndex = 1;
            this.NewPostsSinceDatePicker.Checked = false;
            this.NewPostsSinceDatePicker.CustomFormat = "F";
            this.NewPostsSinceDatePicker.Dock = DockStyle.Top;
            this.NewPostsSinceDatePicker.Format = DateTimePickerFormat.Short;
            point = new Point(3, 3);
            this.NewPostsSinceDatePicker.Location = point;
            this.NewPostsSinceDatePicker.Name = "NewPostsSinceDatePicker";
            this.NewPostsSinceDatePicker.ShowCheckBox = true;
            size = new Size(0x70, 20);
            this.NewPostsSinceDatePicker.Size = size;
            this.NewPostsSinceDatePicker.TabIndex = 0;
            DateTime time = new DateTime(0x76c, 1, 1, 12, 0, 0, 0);
            this.NewPostsSinceDatePicker.Value = time;
            this.CustomPathBuilderButton.Anchor = AnchorStyles.Right;
            point = new Point(0xe5, 0x1d);
            this.CustomPathBuilderButton.Location = point;
            this.CustomPathBuilderButton.Name = "CustomPathBuilderButton";
            size = new Size(0x86, 0x16);
            this.CustomPathBuilderButton.Size = size;
            this.CustomPathBuilderButton.TabIndex = 30;
            this.CustomPathBuilderButton.Text = "Backup File Naming";
            this.CustomPathBuilderButton.UseVisualStyleBackColor = true;
            this.MaxEntriesComboBox.Dock = DockStyle.Fill;
            this.MaxEntriesComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            this.MaxEntriesComboBox.FormattingEnabled = true;
            this.MaxEntriesComboBox.Items.AddRange(new object[] { "No Limit, Get All Posts", "100", "50", "25", "10" });
            point = new Point(150, 0x7c);
            this.MaxEntriesComboBox.Location = point;
            this.MaxEntriesComboBox.Name = "MaxEntriesComboBox";
            size = new Size(0xd5, 0x15);
            this.MaxEntriesComboBox.Size = size;
            this.MaxEntriesComboBox.TabIndex = 13;
            this.Label11.AutoSize = true;
            point = new Point(3, 0x79);
            this.Label11.Location = point;
            this.Label11.Name = "Label11";
            size = new Size(0x74, 13);
            this.Label11.Size = size;
            this.Label11.TabIndex = 12;
            this.Label11.Text = "Maximum posts per file:";
            this.RecentlyProcessedListBox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.RecentlyProcessedListBox.FormattingEnabled = true;
            point = new Point(0x17d, 0x2b);
            this.RecentlyProcessedListBox.Location = point;
            this.RecentlyProcessedListBox.Name = "RecentlyProcessedListBox";
            size = new Size(0x13c, 0x149);
            this.RecentlyProcessedListBox.Size = size;
            this.RecentlyProcessedListBox.TabIndex = 4;
            this.Label8.AutoSize = true;
            point = new Point(0x17a, 0x1b);
            this.Label8.Location = point;
            this.Label8.Name = "Label8";
            size = new Size(0x58, 13);
            this.Label8.Size = size;
            this.Label8.TabIndex = 0x1c;
            this.Label8.Text = "Processed posts:";
            this.PrimaryMenuStrip.Items.AddRange(new ToolStripItem[] { this.FileToolStripMenuItem, this.ToolsToolStripMenuItem, this.HelpToolStripMenuItem });
            point = new Point(0, 0);
            this.PrimaryMenuStrip.Location = point;
            this.PrimaryMenuStrip.Name = "PrimaryMenuStrip";
            size = new Size(0x2c5, 0x18);
            this.PrimaryMenuStrip.Size = size;
            this.PrimaryMenuStrip.TabIndex = 0x1d;
            this.PrimaryMenuStrip.Text = "MenuStrip1";
            this.FileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.NewSettingsToolStripMenuItem, this.ToolStripSeparator3, this.OpenSettingsToolStripMenuItem, this.ToolStripSeparator2, this.SaveSettingsToolStripMenuItem, this.SaveSettingsAsToolStripMenuItem, this.ToolStripSeparator1, this.ExitToolStripMenuItem });
            this.FileToolStripMenuItem.Name = "FileToolStripMenuItem";
            size = new Size(0x25, 20);
            this.FileToolStripMenuItem.Size = size;
            this.FileToolStripMenuItem.Text = "&File";
            this.NewSettingsToolStripMenuItem.Image = (Image) manager.GetObject("NewSettingsToolStripMenuItem.Image");
            this.NewSettingsToolStripMenuItem.ImageTransparentColor = Color.Magenta;
            this.NewSettingsToolStripMenuItem.Name = "NewSettingsToolStripMenuItem";
            this.NewSettingsToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.N;
            size = new Size(200, 0x16);
            this.NewSettingsToolStripMenuItem.Size = size;
            this.NewSettingsToolStripMenuItem.Text = "&New Settings";
            this.ToolStripSeparator3.Name = "ToolStripSeparator3";
            size = new Size(0xc5, 6);
            this.ToolStripSeparator3.Size = size;
            this.OpenSettingsToolStripMenuItem.Image = (Image) manager.GetObject("OpenSettingsToolStripMenuItem.Image");
            this.OpenSettingsToolStripMenuItem.ImageTransparentColor = Color.Magenta;
            this.OpenSettingsToolStripMenuItem.Name = "OpenSettingsToolStripMenuItem";
            this.OpenSettingsToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.O;
            size = new Size(200, 0x16);
            this.OpenSettingsToolStripMenuItem.Size = size;
            this.OpenSettingsToolStripMenuItem.Text = "&Open Settings...";
            this.ToolStripSeparator2.Name = "ToolStripSeparator2";
            size = new Size(0xc5, 6);
            this.ToolStripSeparator2.Size = size;
            this.SaveSettingsToolStripMenuItem.Image = (Image) manager.GetObject("SaveSettingsToolStripMenuItem.Image");
            this.SaveSettingsToolStripMenuItem.ImageTransparentColor = Color.Magenta;
            this.SaveSettingsToolStripMenuItem.Name = "SaveSettingsToolStripMenuItem";
            this.SaveSettingsToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
            size = new Size(200, 0x16);
            this.SaveSettingsToolStripMenuItem.Size = size;
            this.SaveSettingsToolStripMenuItem.Text = "&Save Settings";
            this.SaveSettingsAsToolStripMenuItem.Name = "SaveSettingsAsToolStripMenuItem";
            size = new Size(200, 0x16);
            this.SaveSettingsAsToolStripMenuItem.Size = size;
            this.SaveSettingsAsToolStripMenuItem.Text = "Save Settings &As...";
            this.ToolStripSeparator1.Name = "ToolStripSeparator1";
            size = new Size(0xc5, 6);
            this.ToolStripSeparator1.Size = size;
            this.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem";
            size = new Size(200, 0x16);
            this.ExitToolStripMenuItem.Size = size;
            this.ExitToolStripMenuItem.Text = "E&xit";
            this.ToolsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.OptionsToolStripMenuItem });
            this.ToolsToolStripMenuItem.Name = "ToolsToolStripMenuItem";
            size = new Size(0x30, 20);
            this.ToolsToolStripMenuItem.Size = size;
            this.ToolsToolStripMenuItem.Text = "&Tools";
            this.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem";
            size = new Size(0x7d, 0x16);
            this.OptionsToolStripMenuItem.Size = size;
            this.OptionsToolStripMenuItem.Text = "&Options...";
            this.HelpToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.ViewLogsToolStripMenuItem, this.ReleaseHistoryToolStripMenuItem, this.ToolStripSeparator4, this.AboutToolStripMenuItem });
            this.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem";
            size = new Size(0x2c, 20);
            this.HelpToolStripMenuItem.Size = size;
            this.HelpToolStripMenuItem.Text = "&Help";
            this.ViewLogsToolStripMenuItem.Name = "ViewLogsToolStripMenuItem";
            size = new Size(0xa3, 0x16);
            this.ViewLogsToolStripMenuItem.Size = size;
            this.ViewLogsToolStripMenuItem.Text = "View Logs...";
            this.ReleaseHistoryToolStripMenuItem.Name = "ReleaseHistoryToolStripMenuItem";
            size = new Size(0xa3, 0x16);
            this.ReleaseHistoryToolStripMenuItem.Size = size;
            this.ReleaseHistoryToolStripMenuItem.Text = "Release History...";
            this.ToolStripSeparator4.Name = "ToolStripSeparator4";
            size = new Size(160, 6);
            this.ToolStripSeparator4.Size = size;
            this.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem";
            size = new Size(0xa3, 0x16);
            this.AboutToolStripMenuItem.Size = size;
            this.AboutToolStripMenuItem.Text = "&About...";
            this.RestorePostsButton.Enabled = false;
            point = new Point(9, 0x15b);
            this.RestorePostsButton.Location = point;
            this.RestorePostsButton.Name = "RestorePostsButton";
            size = new Size(0x56, 0x19);
            this.RestorePostsButton.Size = size;
            this.RestorePostsButton.TabIndex = 30;
            this.RestorePostsButton.Text = "Restore Posts";
            this.RestorePostsButton.UseVisualStyleBackColor = true;
            this.OpenSettingsDialog.DefaultExt = "BBSettings";
            this.OpenSettingsDialog.Filter = "Blogger Backup Settings|*.BBSettings|All Files|*.*";
            this.OpenSettingsDialog.Title = "Open Blogger Backup Settings";
            this.SaveSettingsDialog.DefaultExt = "BBSettings";
            this.SaveSettingsDialog.Filter = "Blogger Backup Settings|*.BBSettings|All Files|*.*";
            this.SaveSettingsDialog.Title = "Save Blogger Backup Settings";
            this.Label4.AutoSize = true;
            point = new Point(6, 0x1b);
            this.Label4.Location = point;
            this.Label4.Name = "Label4";
            size = new Size(0x51, 13);
            this.Label4.Size = size;
            this.Label4.TabIndex = 0x1f;
            this.Label4.Text = "Available blogs:";
            this.BlogsComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            this.BlogsComboBox.FormattingEnabled = true;
            point = new Point(0x5d, 0x1b);
            this.BlogsComboBox.Location = point;
            this.BlogsComboBox.Name = "BlogsComboBox";
            size = new Size(0x114, 0x15);
            this.BlogsComboBox.Size = size;
            this.BlogsComboBox.TabIndex = 1;
            this.BlogInformationLabel.BackColor = Color.WhiteSmoke;
            this.BlogInformationLabel.BorderStyle = BorderStyle.Fixed3D;
            this.BlogInformationLabel.ForeColor = Color.Blue;
            point = new Point(9, 0x33);
            this.BlogInformationLabel.Location = point;
            this.BlogInformationLabel.Name = "BlogInformationLabel";
            size = new Size(360, 80);
            this.BlogInformationLabel.Size = size;
            this.BlogInformationLabel.TabIndex = 0x21;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x2c5, 0x196);
            this.ClientSize = size;
            this.Controls.Add(this.BlogInformationLabel);
            this.Controls.Add(this.Label4);
            this.Controls.Add(this.RestorePostsButton);
            this.Controls.Add(this.StopButton);
            this.Controls.Add(this.BackupPostsButton);
            this.Controls.Add(this.BlogsComboBox);
            this.Controls.Add(this.Label8);
            this.Controls.Add(this.RecentlyProcessedListBox);
            this.Controls.Add(this.TableLayoutPanelBottom);
            this.Controls.Add(this.MainStatusStrip);
            this.Controls.Add(this.PrimaryMenuStrip);
            this.HelpButton = true;
            this.Icon = (Icon) manager.GetObject("$this.Icon");
            this.MainMenuStrip = this.PrimaryMenuStrip;
            size = new Size(0x2d5, 0x1ba);
            this.MinimumSize = size;
            this.Name = "MainForm";
            this.Text = "Blogger Backup Utility";
            this.MainStatusStrip.ResumeLayout(false);
            this.MainStatusStrip.PerformLayout();
            this.TableLayoutPanelBottom.ResumeLayout(false);
            this.TableLayoutPanelBottom.PerformLayout();
            this.TableLayoutPanel1.ResumeLayout(false);
            this.PrimaryMenuStrip.ResumeLayout(false);
            this.PrimaryMenuStrip.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        private void LimitComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((((this.LimitComboBox.SelectedIndex > -1) && (this._SelectedBlogSetting != null)) ? 1 : 0) != 0)
            {
                this._SelectedBlogSetting.Limit = ((LimitComboBoxItem) this.LimitComboBox.SelectedItem).Limit;
            }
        }

        private void LoadBlogList()
        {
            List<BlogSetting>.Enumerator enumerator;
            this.BlogsComboBox.Items.Clear();
            this.BlogsComboBox.DisplayMember = "Title";
            this.BlogsComboBox.ValueMember = "ID";
            this.BlogsComboBox.Items.Add("[Add/Update/Remove Blogs]");
            try
            {
                enumerator = this._Settings.BlogSettings.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    BlogSetting current = enumerator.Current;
                    this.BlogsComboBox.Items.Add(current);
                }
            }
            finally
            {
                enumerator.Dispose();
            }
        }

        private void LoadSettings()
        {
            log.Info("[LoadSettings] Start");
            if ((((MySettingsProperty.Settings.LastSettingsSavePath.Length == 0) || !System.IO.File.Exists(MySettingsProperty.Settings.LastSettingsSavePath)) ? 1 : 0) != 0)
            {
                this._Settings = new BloggerBackupSettings();
                this._Settings.Changed = false;
            }
            else
            {
                this._Settings = BloggerBackupSettings.Load(MySettingsProperty.Settings.LastSettingsSavePath);
            }
            this.SetFormTitle();
            this.LoadBlogList();
            log.Info("[LoadSettings] End");
        }

        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (((this.BackupBackgroundWorker.IsBusy || this.RestoreBackgroundWorker.IsBusy) ? 1 : 0) != 0)
            {
                Interaction.MsgBox("Please cancel the current backup or restore processing and then close... Thank you", MsgBoxStyle.OkOnly, null);
                this.StopButton.Select();
                e.Cancel = true;
            }
            this._Settings.DefaultBackupPath = this.BackupPathFolderPicker.SelectedPath;
            this._Settings.FormLocation = this.Location;
            this._Settings.FormSize = this.Size;
            MySettingsProperty.Settings.Save();
            this.SaveSettings();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            this.ChangeLogFilename("RollingLogFileAppender", Path.Combine(MyProject.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData, "ApplicationLog.txt"));
            log.Info("[MainForm_Load] Start");
            log.Info("Loading settings");
            this.LoadSettings();
            this.SetFormTitle();
            log.Info("Setting form size and position");
            if (this._Settings.FormLocation.X > -1)
            {
                this.Location = this._Settings.FormLocation;
            }
            if (this._Settings.FormSize.Height > -1)
            {
                this.Size = this._Settings.FormSize;
            }
            if ((((this._Settings.DefaultBackupPath == null) || (this._Settings.DefaultBackupPath.Length == 0)) ? 1 : 0) != 0)
            {
                this._Settings.DefaultBackupPath = Path.Combine(MyProject.Computer.FileSystem.SpecialDirectories.MyDocuments, "Blogger Backup");
                this._Settings.Changed = false;
            }
            this.BackupPathFolderPicker.SelectedPath = this._Settings.DefaultBackupPath;
            log.Info("Loading comboboxes");
            this.LimitComboBox.Items.Clear();
            this.LimitComboBox.DisplayMember = "Title";
            this.LimitComboBox.ValueMember = "Limit";
            this.LimitComboBox.Items.Add(new LimitComboBoxItem("No Limit, Get Them All", 0));
            this.LimitComboBox.Items.Add(new LimitComboBoxItem("Latest 100", 100));
            this.LimitComboBox.Items.Add(new LimitComboBoxItem("Latest 50", 50));
            this.LimitComboBox.Items.Add(new LimitComboBoxItem("Latest 25", 0x19));
            this.LimitComboBox.Items.Add(new LimitComboBoxItem("Latest 10", 10));
            this.SaveAsComboBox.Items.Clear();
            this.SaveAsComboBox.DisplayMember = "Title";
            this.SaveAsComboBox.ValueMember = "SaveAsFormat";
            this.SaveAsComboBox.Items.Add(new SaveAsComboBoxItem("Atom, one file per post", SaveAsComboBoxItem.SaveAsFormatOptions.AtomFilePerPost));
            this.SaveAsComboBox.Items.Add(new SaveAsComboBoxItem("Atom, all posts in a single file", SaveAsComboBoxItem.SaveAsFormatOptions.AtomSingleFile));
            this.MaxEntriesComboBox.Items.Clear();
            this.MaxEntriesComboBox.DisplayMember = "Title";
            this.MaxEntriesComboBox.ValueMember = "Limit";
            this.MaxEntriesComboBox.Items.Add(new LimitComboBoxItem("No Limit", 0));
            this.MaxEntriesComboBox.Items.Add(new LimitComboBoxItem("100 Posts Per File", 100));
            this.MaxEntriesComboBox.Items.Add(new LimitComboBoxItem("250 Posts Per File", 250));
            this.MaxEntriesComboBox.Items.Add(new LimitComboBoxItem("500 Posts Per File", 500));
            log.Info("Setting up Default Save Name options");
            if (this._Settings.DefaultSaveNameOptions == null)
            {
                this._Settings.DefaultSaveNameOptions = new SelectedSaveNameOptions();
                this._Settings.DefaultSaveNameOptions.FolderNameOptions.Add(this._AllSaveOptions.FolderNameOptions[0]);
                this._Settings.DefaultSaveNameOptions.PostNameOptions.Add(this._AllSaveOptions.PostNameOptions[0]);
                this._Settings.DefaultSaveNameOptions.PostNameOptions.Add(this._AllSaveOptions.PostNameOptions[1]);
                this._Settings.DefaultSaveNameOptions.PostNameOptions.Add(this._AllSaveOptions.PostNameOptions[2]);
                this._Settings.Changed = false;
            }
            if (this._Settings.DefaultSaveNameOptions.FolderNameOptions.Count == 0)
            {
                this._Settings.DefaultSaveNameOptions.FolderNameOptions.Add(this._AllSaveOptions.FolderNameOptions[0]);
                this._Settings.Changed = false;
            }
            if (this._Settings.DefaultSaveNameOptions.PostNameOptions.Count == 0)
            {
                this._Settings.DefaultSaveNameOptions.PostNameOptions.Add(this._AllSaveOptions.PostNameOptions[0]);
                this._Settings.DefaultSaveNameOptions.PostNameOptions.Add(this._AllSaveOptions.PostNameOptions[1]);
                this._Settings.DefaultSaveNameOptions.PostNameOptions.Add(this._AllSaveOptions.PostNameOptions[2]);
                this._Settings.Changed = false;
            }
            log.Info("Loading Blog List");
            this.LoadBlogList();
            if ((((this._Settings.LastUsedBlog != null) && this._Settings.BlogSettings.Contains(this._Settings.LastUsedBlog)) ? 1 : 0) != 0)
            {
                this.BlogsComboBox.SelectedItem = this._Settings.LastUsedBlog;
            }
            log.Info("[MainForm_Load] End");
        }

        private void MaintainBlogList()
        {
            BlogList list = new BlogList();
            if (list.ShowDialog(this, this._Settings, log) == DialogResult.OK)
            {
                this.LoadBlogList();
            }
            list.Dispose();
        }

        private void MaxEntriesComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((((this.MaxEntriesComboBox.SelectedIndex > -1) && (this._SelectedBlogSetting != null)) ? 1 : 0) != 0)
            {
                this._SelectedBlogSetting.MaxEntries = ((LimitComboBoxItem) this.MaxEntriesComboBox.SelectedItem).Limit;
            }
        }

        private void NewPostsSinceDateTimePicker_ValueChanged(object sender, EventArgs e)
        {
            if (this.NewPostsSinceDatePicker.Checked)
            {
                this.NewPostsSinceTimePicker.Enabled = true;
            }
            else
            {
                this.NewPostsSinceTimePicker.Enabled = false;
            }
        }

        private void NewSettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (((((this._Settings != null) && this._Settings.Changed) ? 1 : 0) != 0) && (Interaction.MsgBox("Save the existing settings?", MsgBoxStyle.YesNo, null) == MsgBoxResult.Yes))
            {
                BloggerBackupSettings.Save(this._Settings, MySettingsProperty.Settings.LastSettingsSavePath);
            }
            this._Settings = null;
            this._Settings = new BloggerBackupSettings();
            MySettingsProperty.Settings.LastSettingsSavePath = "";
            this.SetFormTitle();
            this.LoadBlogList();
        }

        private void OpenSettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (((((this._Settings != null) && this._Settings.Changed) ? 1 : 0) != 0) && (Interaction.MsgBox("Save the existing settings?", MsgBoxStyle.YesNo, null) == MsgBoxResult.Yes))
            {
                BloggerBackupSettings.Save(this._Settings, MySettingsProperty.Settings.LastSettingsSavePath);
            }
            this.OpenSettingsDialog.FileName = "BloggerBackup";
            this.OpenSettingsDialog.DefaultExt = "BBSettings";
            switch (((int) this.OpenSettingsDialog.ShowDialog(this)))
            {
                case 1:
                    MySettingsProperty.Settings.LastSettingsSavePath = this.OpenSettingsDialog.FileName;
                    this._Settings = null;
                    this.LoadSettings();
                    break;
            }
        }

        private void OptionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Options options = new Options();
            options.ShowDialog(this);
            options.Dispose();
        }

        private void OverwriteCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            if (this._SelectedBlogSetting != null)
            {
                this._SelectedBlogSetting.OverwriteExisting = this.OverwriteCheckBox.Checked;
            }
        }

        private void ProgressUpdate(int BatchSize, int BatchProgress, string LastSavedPost, string savedFilename)
        {
            if (this.InvokeRequired)
            {
                ProgressUpdateDelegate method = new ProgressUpdateDelegate(this.ProgressUpdate);
                this.Invoke(method, new object[] { BatchSize, BatchProgress, LastSavedPost, savedFilename });
            }
            else
            {
                this.ToolStripProgressBar1.Maximum = BatchSize;
                if (BatchProgress <= this.ToolStripProgressBar1.Maximum)
                {
                    this.ToolStripProgressBar1.Value = BatchProgress;
                }
                this.RecentlyProcessedListBox.DisplayMember = "Title";
                this.RecentlyProcessedListBox.ValueMember = "Filename";
                this.RecentlyProcessedListBox.Items.Add(new ProcessingResultListboxItem(LastSavedPost, savedFilename));
                if (savedFilename.Length > 0)
                {
                    log.Info("Processed post " + LastSavedPost + " Saved to file " + savedFilename);
                }
                else
                {
                    log.Info("Processed post " + LastSavedPost);
                }
            }
        }

        private void RecentlyProcessedListBox_DoubleClick(object sender, EventArgs e)
        {
            if (this.RecentlyProcessedListBox.SelectedItem != null)
            {
                ProcessingResultListboxItem selectedItem = this.RecentlyProcessedListBox.SelectedItem as ProcessingResultListboxItem;
                if ((selectedItem != null) && (selectedItem.Filename.Length != 0))
                {
                    try
                    {
                        Process.Start(selectedItem.Filename);
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        Interaction.MsgBox("Error opening " + selectedItem.Filename + "\r\n\r\n" + exception.Message, MsgBoxStyle.OkOnly, null);
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        private void ReleaseHistoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Process.Start(MyProject.Application.Info.DirectoryPath + @"\ReleaseHistory.txt");
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox("Error opening " + MyProject.Application.Info.DirectoryPath + "\\ReleaseHistory.txt\r\n\r\n" + exception.Message, MsgBoxStyle.OkOnly, null);
                ProjectData.ClearProjectError();
            }
        }

        private void RestoreBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorkerHelper argument = (BackgroundWorkerHelper) e.Argument;
            this.RestorePosts(argument);
        }

        private void RestoreBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.TableLayoutPanelBottom.Enabled = true;
            this.BackupPostsButton.Enabled = true;
            this.RestorePostsButton.Enabled = true;
            this.StopButton.Enabled = false;
            this.ToolStripProgressBar1.Value = 0;
            this.StatusUpdate("Done");
            this._service = null;
        }

        private void RestorePosts(BackgroundWorkerHelper bwh)
        {
            int downloaded = 0;
            List<string> fileList = bwh.FileList;
            this.StatusUpdate("Here we go...");
            this.TotalDownloaded(-1);
            foreach (string str in fileList)
            {
                IEnumerator enumerator;
                IEnumerator enumerator3;
                AtomEntry newEntry = new AtomEntry();
                XmlDocument document = new XmlDocument();
                this.StatusUpdate("Loading " + str);
                try
                {
                    document.Load(str);
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    if (Interaction.MsgBox(exception.Message, MsgBoxStyle.OkCancel, "Error Loading Post XML") == MsgBoxResult.Cancel)
                    {
                        this.StatusUpdate("Error : " + exception.Message);
                        ProjectData.ClearProjectError();
                        break;
                    }
                    ProjectData.ClearProjectError();
                }
                if (document.GetElementsByTagName("title").Count > 0)
                {
                    this.StatusUpdate("Creating post " + document.GetElementsByTagName("title").Item(0).InnerText);
                }
                else
                {
                    this.StatusUpdate("Creating post...");
                }
                if (document.GetElementsByTagName("title").Count > 0)
                {
                    newEntry.Title.Text = document.GetElementsByTagName("title").Item(0).InnerText;
                }
                newEntry.Content = new AtomContent();
                newEntry.Content.Content = document.GetElementsByTagName("content").Item(0).InnerText;
                newEntry.Content.Type = "html";
                if (DateTime.Compare(bwh.OverridePublishedDate, DateTime.MinValue) == 0)
                {
                    AtomEntry entry2 = newEntry;
                    DateTime published = entry2.Published;
                    entry2.Published = published;
                    if (!DateTime.TryParse(document.GetElementsByTagName("published").Item(0).InnerText, out published))
                    {
                        newEntry.Published = DateAndTime.Now;
                    }
                }
                else
                {
                    newEntry.Published = bwh.OverridePublishedDate;
                }
                try
                {
                    enumerator = document.GetElementsByTagName("author").GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        XmlElement current = (XmlElement) enumerator.Current;
                        newEntry.Authors.Add(new AtomPerson(AtomPersonType.Author, current.InnerText));
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                try
                {
                    enumerator3 = document.GetElementsByTagName("category").GetEnumerator();
                    while (enumerator3.MoveNext())
                    {
                        XmlElement element2 = (XmlElement) enumerator3.Current;
                        newEntry.Categories.Add(new AtomCategory(element2.GetAttribute("term").ToString(), element2.GetAttribute("scheme").ToString()));
                    }
                }
                finally
                {
                    if (enumerator3 is IDisposable)
                    {
                        (enumerator3 as IDisposable).Dispose();
                    }
                }
                this.StatusUpdate("Posting to Blogger");
                try
                {
                    this._service.Insert(new Uri(bwh.URL), newEntry);
                }
                catch (Exception exception3)
                {
                    ProjectData.SetProjectError(exception3);
                    Exception exception2 = exception3;
                    if (Interaction.MsgBox(exception2.Message, MsgBoxStyle.OkCancel, "Error Posting to Blogger") == MsgBoxResult.Cancel)
                    {
                        this.StatusUpdate("Error : " + exception2.Message);
                        ProjectData.ClearProjectError();
                        break;
                    }
                    ProjectData.ClearProjectError();
                }
                downloaded++;
                this.TotalDownloaded(downloaded);
                BlogSetting setting = this._SelectedBlogSetting;
                setting.LastRestoredPostCount++;
                if (document.GetElementsByTagName("title").Count > 0)
                {
                    this.ProgressUpdate(fileList.Count, downloaded, document.GetElementsByTagName("title").Item(0).InnerText, str);
                }
                else
                {
                    this.ProgressUpdate(fileList.Count, downloaded, "[NoTitle]", str);
                }
            }
            this.StatusUpdate("Done");
        }

        private void RestorePostsButton_Click(object sender, EventArgs e)
        {
            if ((this.BlogsComboBox.SelectedIndex != -1) && (this._SelectedBlogSetting != null))
            {
                if (DateTime.Compare(this._SelectedBlogSetting.LastRestoredPostsOn, DateAndTime.Today) == 0)
                {
                    if ((this._SelectedBlogSetting.LastRestoredPostCount > 50) && (Interaction.MsgBox("Blogger has a limit of 50 posts per blog per day. You've restored " + Conversions.ToString(0) + " posts. Are you sure you wish to continue?", MsgBoxStyle.YesNo, "50 Post Restore Limit") == MsgBoxResult.No))
                    {
                        return;
                    }
                }
                else
                {
                    this._SelectedBlogSetting.LastRestoredPostsOn = DateAndTime.Today;
                    this._SelectedBlogSetting.LastRestoredPostCount = 0;
                }
                RestoreForm form = new RestoreForm();
                string userId = "";
                string password = "";
                DateTime overridePublishedDate = new DateTime();
                List<string> list = form.GetPostsToRestore(this.BackupPathFolderPicker.SelectedPath, this._Settings, this._SelectedBlogSetting, log, ref userId, ref password, ref overridePublishedDate);
                form.Dispose();
                if (list.Count != 0)
                {
                    this.TableLayoutPanelBottom.Enabled = false;
                    this.BackupPostsButton.Enabled = false;
                    this.RestorePostsButton.Enabled = false;
                    this.StopButton.Enabled = true;
                    this.RecentlyProcessedListBox.Items.Clear();
                    this.StatusUpdate("Starting restore process...");
                    if (this._SelectedBlogSetting.UserName != userId)
                    {
                        this._SelectedBlogSetting.UserName = userId;
                    }
                    this.SetupBloggerService(userId, password);
                    BlogSetting selectedItem = (BlogSetting) this.BlogsComboBox.SelectedItem;
                    this.RecentlyProcessedListBox.Items.Clear();
                    string selectedPath = this.BackupPathFolderPicker.SelectedPath;
                    BackgroundWorkerHelper argument = new BackgroundWorkerHelper(selectedItem.FeedURL, selectedPath, DateAndTime.Now, selectedItem.Title, selectedItem, overridePublishedDate);
                    argument.FileList = list;
                    this._Settings.LastUsedBlog = selectedItem;
                    this.RestoreBackgroundWorker.RunWorkerAsync(argument);
                }
            }
        }

        private void SaveAsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((this.SaveAsComboBox.SelectedIndex != -1) && (this._SelectedBlogSetting != null))
            {
                this._SelectedBlogSetting.SaveFormat = (int) ((SaveAsComboBoxItem) this.SaveAsComboBox.SelectedItem).SaveAsFormat;
                switch (this._SelectedBlogSetting.SaveFormat)
                {
                    case 0:
                        this.MaxEntriesComboBox.Enabled = false;
                        break;

                    case 1:
                        this.MaxEntriesComboBox.Enabled = true;
                        break;
                }
            }
        }

        private void SaveCommentsCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            if (this._SelectedBlogSetting != null)
            {
                this._SelectedBlogSetting.SaveComments = this.SaveCommentsCheckBox.Checked;
            }
        }

        private void SaveSettings()
        {
            log.Info("[SaveSettings] Start");
            if ((((MySettingsProperty.Settings.LastSettingsSavePath.Length == 0) || !System.IO.File.Exists(MySettingsProperty.Settings.LastSettingsSavePath)) ? 1 : 0) != 0)
            {
                this.SaveSettingsDialog.FileName = "BloggerBackup";
                this.SaveSettingsDialog.DefaultExt = "BBSettings";
                switch (((int) this.SaveSettingsDialog.ShowDialog(this)))
                {
                    case 1:
                        MySettingsProperty.Settings.LastSettingsSavePath = this.SaveSettingsDialog.FileName;
                        break;

                    case 2:
                        if (Interaction.MsgBox("Are you sure you do not want to save these settings?", MsgBoxStyle.YesNo, null) == MsgBoxResult.No)
                        {
                            DialogResult result2 = this.SaveSettingsDialog.ShowDialog(this);
                            if (result2 == DialogResult.OK)
                            {
                                MySettingsProperty.Settings.LastSettingsSavePath = this.SaveSettingsDialog.FileName;
                            }
                        }
                        break;
                }
            }
            if (MySettingsProperty.Settings.LastSettingsSavePath.Length > 0)
            {
                BloggerBackupSettings.Save(this._Settings, MySettingsProperty.Settings.LastSettingsSavePath);
                this.SetFormTitle();
            }
            log.Info("[SaveSettings] End");
        }

        private void SaveSettingsAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (((((this._Settings != null) && this._Settings.Changed) ? 1 : 0) != 0) && (Interaction.MsgBox("Save the existing settings?", MsgBoxStyle.YesNo, null) == MsgBoxResult.Yes))
            {
                BloggerBackupSettings.Save(this._Settings, MySettingsProperty.Settings.LastSettingsSavePath);
            }
            MySettingsProperty.Settings.LastSettingsSavePath = "";
            this.SaveSettings();
        }

        private void SaveSettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.SaveSettings();
        }

        private void SetFormTitle()
        {
            if (MySettingsProperty.Settings.LastSettingsSavePath.Length > 0)
            {
                this.Text = "Blogger Backup Utility [" + MyProject.Application.Info.Version.ToString() + "] - " + Path.GetFileName(MySettingsProperty.Settings.LastSettingsSavePath);
            }
            else
            {
                this.Text = "Blogger Backup Utility [" + MyProject.Application.Info.Version.ToString() + "] - SETTINGS UNSAVED";
            }
        }

        private void SetupBloggerService(string userName, string password)
        {
            if (this._service == null)
            {
                this._service = new Service("blogger", "BloggerBackupApp");
            }
            if ((this._service.Credentials == null) && ((((userName != null) && (userName.Length > 0)) ? 1 : 0) != 0))
            {
                GDataCredentials credentials = new GDataCredentials(userName, password);
                this._service.Credentials = credentials;
            }
            GDataRequestFactory requestFactory = (GDataRequestFactory) this._service.RequestFactory;
            requestFactory.KeepAlive = true;
            if (this._Settings.ProxyEnabled)
            {
                string proxyURL;
                if ((((this._Settings.ProxyURL != null) && (this._Settings.ProxyPort > 0)) ? 1 : 0) != 0)
                {
                    proxyURL = this._Settings.ProxyURL + ":" + this._Settings.ToString();
                }
                else
                {
                    proxyURL = this._Settings.ProxyURL;
                }
                WebProxy proxy = new WebProxy(proxyURL);
                if ((((this._Settings.ProxyUserId != null) && (this._Settings.ProxyUserId.Length > 0)) ? 1 : 0) != 0)
                {
                    proxy.Credentials = new NetworkCredential(this._Settings.ProxyUserId, DPAPI.UnProtectData(this._Settings.ProxyPassword, BloggerBackup.My.Resources.Resources.BlogURL));
                }
                GDataRequestFactory factory2 = (GDataRequestFactory) this._service.RequestFactory;
                factory2.Proxy = proxy;
                this.StatusUpdate("Using proxy " + proxyURL);
            }
        }

        private XmlTextWriter StartSingleAtomXML(string backupPath, AtomFeed bloggerAtomFeed, int batch)
        {
            XmlTextWriter writer = null;
            string str;
            IEnumerator enumerator;
            IEnumerator enumerator2;
            if (batch > 0)
            {
                str = this.GetSafeSaveFileName(backupPath, bloggerAtomFeed.Title.Text + "-" + batch.ToString("0000"), "xml", this._SelectedBlogSetting.OverwriteExisting);
            }
            else
            {
                str = this.GetSafeSaveFileName(backupPath, bloggerAtomFeed.Title.Text, "xml", this._SelectedBlogSetting.OverwriteExisting);
            }
            writer = new XmlTextWriter(str, Encoding.UTF8);
            writer.WriteStartDocument();
            writer.WriteStartElement("feed", "http://www.w3.org/2005/Atom");
            writer.WriteAttributeString("xmlns:opensearch", "http://a9.com/-/spec/opensearchrss/1.0/");
            writer.Formatting = Formatting.Indented;
            try
            {
                enumerator = bloggerAtomFeed.Authors.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    ((AtomPerson) enumerator.Current).SaveToXml(writer);
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            bloggerAtomFeed.Generator.SaveToXml(writer);
            bloggerAtomFeed.Id.SaveToXml(writer);
            try
            {
                enumerator2 = bloggerAtomFeed.Links.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    AtomLink current = (AtomLink) enumerator2.Current;
                    if (current.ShouldBePersisted())
                    {
                        current.SaveToXml(writer);
                    }
                }
            }
            finally
            {
                if (enumerator2 is IDisposable)
                {
                    (enumerator2 as IDisposable).Dispose();
                }
            }
            bloggerAtomFeed.Title.SaveToXml(writer);
            writer.WriteElementString("updated", Utilities.LocalDateTimeInUTC(bloggerAtomFeed.Updated));
            return writer;
        }

        private void StatusUpdate(string Message)
        {
            if (this.InvokeRequired)
            {
                StatusUpdateDelegate method = new StatusUpdateDelegate(this.StatusUpdate);
                this.Invoke(method, new object[] { Message });
            }
            else
            {
                this.StatusLabel.Text = Message;
                log.Info(Message);
            }
        }

        private void StopButton_Click(object sender, EventArgs e)
        {
            this.StopButton.Enabled = false;
            this.StatusUpdate("Canceling... Please stand by");
            if (this.BackupBackgroundWorker.IsBusy)
            {
                this.BackupBackgroundWorker.CancelAsync();
            }
            if (this.RestoreBackgroundWorker.IsBusy)
            {
                this.RestoreBackgroundWorker.CancelAsync();
            }
        }

        private void TotalDownloaded(int Downloaded)
        {
            if (this.InvokeRequired)
            {
                TotalDownloadedDelegate method = new TotalDownloadedDelegate(this.TotalDownloaded);
                this.Invoke(method, new object[] { Downloaded });
            }
            else if (Downloaded >= 0)
            {
                this.DownloadedStatusLabel.Text = Downloaded.ToString();
            }
            else
            {
                this.DownloadedStatusLabel.Text = "";
            }
        }

        private void ViewLogsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Process.Start(MyProject.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData);
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox("Error opening " + MyProject.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData + "\r\n\r\n" + exception.Message, MsgBoxStyle.OkOnly, null);
                ProjectData.ClearProjectError();
            }
        }

        internal virtual ToolStripMenuItem AboutToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AboutToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.AboutToolStripMenuItem_Click);
                if (this._AboutToolStripMenuItem != null)
                {
                    this._AboutToolStripMenuItem.Click -= handler;
                }
                this._AboutToolStripMenuItem = value;
                if (this._AboutToolStripMenuItem != null)
                {
                    this._AboutToolStripMenuItem.Click += handler;
                }
            }
        }

        internal virtual BackgroundWorker BackupBackgroundWorker
        {
            [DebuggerNonUserCode]
            get
            {
                return this._BackupBackgroundWorker;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                RunWorkerCompletedEventHandler handler = new RunWorkerCompletedEventHandler(this.BackupBackgroundWorker_RunWorkerCompleted);
                DoWorkEventHandler handler2 = new DoWorkEventHandler(this.BackupBackgroundWorker_DoWork);
                if (this._BackupBackgroundWorker != null)
                {
                    this._BackupBackgroundWorker.RunWorkerCompleted -= handler;
                    this._BackupBackgroundWorker.DoWork -= handler2;
                }
                this._BackupBackgroundWorker = value;
                if (this._BackupBackgroundWorker != null)
                {
                    this._BackupBackgroundWorker.RunWorkerCompleted += handler;
                    this._BackupBackgroundWorker.DoWork += handler2;
                }
            }
        }

        internal virtual FolderPicker BackupPathFolderPicker
        {
            [DebuggerNonUserCode]
            get
            {
                return this._BackupPathFolderPicker;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._BackupPathFolderPicker = value;
            }
        }

        internal virtual Button BackupPostsButton
        {
            [DebuggerNonUserCode]
            get
            {
                return this._BackupPostsButton;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.BackupPostsButton_Click);
                if (this._BackupPostsButton != null)
                {
                    this._BackupPostsButton.Click -= handler;
                }
                this._BackupPostsButton = value;
                if (this._BackupPostsButton != null)
                {
                    this._BackupPostsButton.Click += handler;
                }
            }
        }

        internal virtual Label BlogInformationLabel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._BlogInformationLabel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._BlogInformationLabel = value;
            }
        }

        internal virtual ComboBox BlogsComboBox
        {
            [DebuggerNonUserCode]
            get
            {
                return this._BlogsComboBox;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.BlogsComboBox_SelectedIndexChanged);
                if (this._BlogsComboBox != null)
                {
                    this._BlogsComboBox.SelectedIndexChanged -= handler;
                }
                this._BlogsComboBox = value;
                if (this._BlogsComboBox != null)
                {
                    this._BlogsComboBox.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual Button CustomPathBuilderButton
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CustomPathBuilderButton;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CustomPathBuilderButton_Click);
                if (this._CustomPathBuilderButton != null)
                {
                    this._CustomPathBuilderButton.Click -= handler;
                }
                this._CustomPathBuilderButton = value;
                if (this._CustomPathBuilderButton != null)
                {
                    this._CustomPathBuilderButton.Click += handler;
                }
            }
        }

        internal virtual ToolStripStatusLabel DownloadedStatusLabel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._DownloadedStatusLabel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._DownloadedStatusLabel = value;
            }
        }

        internal virtual ToolStripMenuItem ExitToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ExitToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.ExitToolStripMenuItem_Click);
                if (this._ExitToolStripMenuItem != null)
                {
                    this._ExitToolStripMenuItem.Click -= handler;
                }
                this._ExitToolStripMenuItem = value;
                if (this._ExitToolStripMenuItem != null)
                {
                    this._ExitToolStripMenuItem.Click += handler;
                }
            }
        }

        internal virtual ToolStripMenuItem FileToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._FileToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._FileToolStripMenuItem = value;
            }
        }

        internal virtual ToolStripMenuItem HelpToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._HelpToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._HelpToolStripMenuItem = value;
            }
        }

        internal virtual Label Label10
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label10;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label10 = value;
            }
        }

        internal virtual Label Label11
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label11;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label11 = value;
            }
        }

        internal virtual Label Label12
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label12;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label12 = value;
            }
        }

        internal virtual Label Label4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label4 = value;
            }
        }

        internal virtual Label Label5
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label5;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label5 = value;
            }
        }

        internal virtual Label Label6
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label6;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label6 = value;
            }
        }

        internal virtual Label Label8
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label8;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label8 = value;
            }
        }

        internal virtual Label Label9
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label9;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label9 = value;
            }
        }

        internal virtual ComboBox LimitComboBox
        {
            [DebuggerNonUserCode]
            get
            {
                return this._LimitComboBox;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.LimitComboBox_SelectedIndexChanged);
                if (this._LimitComboBox != null)
                {
                    this._LimitComboBox.SelectedIndexChanged -= handler;
                }
                this._LimitComboBox = value;
                if (this._LimitComboBox != null)
                {
                    this._LimitComboBox.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual StatusStrip MainStatusStrip
        {
            [DebuggerNonUserCode]
            get
            {
                return this._MainStatusStrip;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._MainStatusStrip = value;
            }
        }

        internal virtual ComboBox MaxEntriesComboBox
        {
            [DebuggerNonUserCode]
            get
            {
                return this._MaxEntriesComboBox;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.MaxEntriesComboBox_SelectedIndexChanged);
                if (this._MaxEntriesComboBox != null)
                {
                    this._MaxEntriesComboBox.SelectedIndexChanged -= handler;
                }
                this._MaxEntriesComboBox = value;
                if (this._MaxEntriesComboBox != null)
                {
                    this._MaxEntriesComboBox.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual DateTimePicker NewPostsSinceDatePicker
        {
            [DebuggerNonUserCode]
            get
            {
                return this._NewPostsSinceDatePicker;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.NewPostsSinceDateTimePicker_ValueChanged);
                if (this._NewPostsSinceDatePicker != null)
                {
                    this._NewPostsSinceDatePicker.ValueChanged -= handler;
                }
                this._NewPostsSinceDatePicker = value;
                if (this._NewPostsSinceDatePicker != null)
                {
                    this._NewPostsSinceDatePicker.ValueChanged += handler;
                }
            }
        }

        internal virtual DateTimePicker NewPostsSinceTimePicker
        {
            [DebuggerNonUserCode]
            get
            {
                return this._NewPostsSinceTimePicker;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._NewPostsSinceTimePicker = value;
            }
        }

        internal virtual ToolStripMenuItem NewSettingsToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._NewSettingsToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.NewSettingsToolStripMenuItem_Click);
                if (this._NewSettingsToolStripMenuItem != null)
                {
                    this._NewSettingsToolStripMenuItem.Click -= handler;
                }
                this._NewSettingsToolStripMenuItem = value;
                if (this._NewSettingsToolStripMenuItem != null)
                {
                    this._NewSettingsToolStripMenuItem.Click += handler;
                }
            }
        }

        internal virtual OpenFileDialog OpenSettingsDialog
        {
            [DebuggerNonUserCode]
            get
            {
                return this._OpenSettingsDialog;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._OpenSettingsDialog = value;
            }
        }

        internal virtual ToolStripMenuItem OpenSettingsToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._OpenSettingsToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.OpenSettingsToolStripMenuItem_Click);
                if (this._OpenSettingsToolStripMenuItem != null)
                {
                    this._OpenSettingsToolStripMenuItem.Click -= handler;
                }
                this._OpenSettingsToolStripMenuItem = value;
                if (this._OpenSettingsToolStripMenuItem != null)
                {
                    this._OpenSettingsToolStripMenuItem.Click += handler;
                }
            }
        }

        internal virtual ToolStripMenuItem OptionsToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._OptionsToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.OptionsToolStripMenuItem_Click);
                if (this._OptionsToolStripMenuItem != null)
                {
                    this._OptionsToolStripMenuItem.Click -= handler;
                }
                this._OptionsToolStripMenuItem = value;
                if (this._OptionsToolStripMenuItem != null)
                {
                    this._OptionsToolStripMenuItem.Click += handler;
                }
            }
        }

        internal virtual CheckBox OverwriteCheckBox
        {
            [DebuggerNonUserCode]
            get
            {
                return this._OverwriteCheckBox;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.OverwriteCheckBox_CheckedChanged);
                if (this._OverwriteCheckBox != null)
                {
                    this._OverwriteCheckBox.CheckedChanged -= handler;
                }
                this._OverwriteCheckBox = value;
                if (this._OverwriteCheckBox != null)
                {
                    this._OverwriteCheckBox.CheckedChanged += handler;
                }
            }
        }

        internal virtual MenuStrip PrimaryMenuStrip
        {
            [DebuggerNonUserCode]
            get
            {
                return this._PrimaryMenuStrip;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._PrimaryMenuStrip = value;
            }
        }

        internal virtual ListBox RecentlyProcessedListBox
        {
            [DebuggerNonUserCode]
            get
            {
                return this._RecentlyProcessedListBox;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.RecentlyProcessedListBox_DoubleClick);
                if (this._RecentlyProcessedListBox != null)
                {
                    this._RecentlyProcessedListBox.DoubleClick -= handler;
                }
                this._RecentlyProcessedListBox = value;
                if (this._RecentlyProcessedListBox != null)
                {
                    this._RecentlyProcessedListBox.DoubleClick += handler;
                }
            }
        }

        internal virtual ToolStripMenuItem ReleaseHistoryToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ReleaseHistoryToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.ReleaseHistoryToolStripMenuItem_Click);
                if (this._ReleaseHistoryToolStripMenuItem != null)
                {
                    this._ReleaseHistoryToolStripMenuItem.Click -= handler;
                }
                this._ReleaseHistoryToolStripMenuItem = value;
                if (this._ReleaseHistoryToolStripMenuItem != null)
                {
                    this._ReleaseHistoryToolStripMenuItem.Click += handler;
                }
            }
        }

        internal virtual BackgroundWorker RestoreBackgroundWorker
        {
            [DebuggerNonUserCode]
            get
            {
                return this._RestoreBackgroundWorker;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                RunWorkerCompletedEventHandler handler = new RunWorkerCompletedEventHandler(this.RestoreBackgroundWorker_RunWorkerCompleted);
                DoWorkEventHandler handler2 = new DoWorkEventHandler(this.RestoreBackgroundWorker_DoWork);
                if (this._RestoreBackgroundWorker != null)
                {
                    this._RestoreBackgroundWorker.RunWorkerCompleted -= handler;
                    this._RestoreBackgroundWorker.DoWork -= handler2;
                }
                this._RestoreBackgroundWorker = value;
                if (this._RestoreBackgroundWorker != null)
                {
                    this._RestoreBackgroundWorker.RunWorkerCompleted += handler;
                    this._RestoreBackgroundWorker.DoWork += handler2;
                }
            }
        }

        internal virtual Button RestorePostsButton
        {
            [DebuggerNonUserCode]
            get
            {
                return this._RestorePostsButton;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.RestorePostsButton_Click);
                if (this._RestorePostsButton != null)
                {
                    this._RestorePostsButton.Click -= handler;
                }
                this._RestorePostsButton = value;
                if (this._RestorePostsButton != null)
                {
                    this._RestorePostsButton.Click += handler;
                }
            }
        }

        internal virtual ComboBox SaveAsComboBox
        {
            [DebuggerNonUserCode]
            get
            {
                return this._SaveAsComboBox;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.SaveAsComboBox_SelectedIndexChanged);
                if (this._SaveAsComboBox != null)
                {
                    this._SaveAsComboBox.SelectedIndexChanged -= handler;
                }
                this._SaveAsComboBox = value;
                if (this._SaveAsComboBox != null)
                {
                    this._SaveAsComboBox.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual CheckBox SaveCommentsCheckBox
        {
            [DebuggerNonUserCode]
            get
            {
                return this._SaveCommentsCheckBox;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.SaveCommentsCheckBox_CheckedChanged);
                if (this._SaveCommentsCheckBox != null)
                {
                    this._SaveCommentsCheckBox.CheckedChanged -= handler;
                }
                this._SaveCommentsCheckBox = value;
                if (this._SaveCommentsCheckBox != null)
                {
                    this._SaveCommentsCheckBox.CheckedChanged += handler;
                }
            }
        }

        internal virtual Label SaveCommentsLabel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._SaveCommentsLabel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._SaveCommentsLabel = value;
            }
        }

        internal virtual ToolStripMenuItem SaveSettingsAsToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._SaveSettingsAsToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.SaveSettingsAsToolStripMenuItem_Click);
                if (this._SaveSettingsAsToolStripMenuItem != null)
                {
                    this._SaveSettingsAsToolStripMenuItem.Click -= handler;
                }
                this._SaveSettingsAsToolStripMenuItem = value;
                if (this._SaveSettingsAsToolStripMenuItem != null)
                {
                    this._SaveSettingsAsToolStripMenuItem.Click += handler;
                }
            }
        }

        internal virtual SaveFileDialog SaveSettingsDialog
        {
            [DebuggerNonUserCode]
            get
            {
                return this._SaveSettingsDialog;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._SaveSettingsDialog = value;
            }
        }

        internal virtual ToolStripMenuItem SaveSettingsToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._SaveSettingsToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.SaveSettingsToolStripMenuItem_Click);
                if (this._SaveSettingsToolStripMenuItem != null)
                {
                    this._SaveSettingsToolStripMenuItem.Click -= handler;
                }
                this._SaveSettingsToolStripMenuItem = value;
                if (this._SaveSettingsToolStripMenuItem != null)
                {
                    this._SaveSettingsToolStripMenuItem.Click += handler;
                }
            }
        }

        internal virtual ToolStripStatusLabel StatusLabel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._StatusLabel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._StatusLabel = value;
            }
        }

        internal virtual Button StopButton
        {
            [DebuggerNonUserCode]
            get
            {
                return this._StopButton;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.StopButton_Click);
                if (this._StopButton != null)
                {
                    this._StopButton.Click -= handler;
                }
                this._StopButton = value;
                if (this._StopButton != null)
                {
                    this._StopButton.Click += handler;
                }
            }
        }

        internal virtual TableLayoutPanel TableLayoutPanel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TableLayoutPanel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TableLayoutPanel1 = value;
            }
        }

        internal virtual TableLayoutPanel TableLayoutPanelBottom
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TableLayoutPanelBottom;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TableLayoutPanelBottom = value;
            }
        }

        internal virtual ToolStripMenuItem ToolsToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolsToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolsToolStripMenuItem = value;
            }
        }

        internal virtual ToolStripProgressBar ToolStripProgressBar1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripProgressBar1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripProgressBar1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator2 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator3 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator4 = value;
            }
        }

        internal virtual ToolStripMenuItem ViewLogsToolStripMenuItem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ViewLogsToolStripMenuItem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.ViewLogsToolStripMenuItem_Click);
                if (this._ViewLogsToolStripMenuItem != null)
                {
                    this._ViewLogsToolStripMenuItem.Click -= handler;
                }
                this._ViewLogsToolStripMenuItem = value;
                if (this._ViewLogsToolStripMenuItem != null)
                {
                    this._ViewLogsToolStripMenuItem.Click += handler;
                }
            }
        }

        private class BackgroundWorkerHelper
        {
            public string BackupPath;
            public BlogSetting Blog;
            public string BlogTitle;
            public List<string> FileList;
            public DateTime NewPostsSince;
            public DateTime OverridePublishedDate;
            public string URL;

            public BackgroundWorkerHelper(string url, string path, DateTime newPostsSince, string blogTitleText, BlogSetting WorkingBlog)
            {
                this.OverridePublishedDate = new DateTime();
                this.URL = url;
                this.BackupPath = path;
                this.NewPostsSince = newPostsSince;
                this.BlogTitle = blogTitleText;
                this.Blog = WorkingBlog;
                this.OverridePublishedDate = new DateTime();
            }

            public BackgroundWorkerHelper(string url, string path, DateTime newPostsSince, string blogTitleText, BlogSetting WorkingBlog, DateTime workingPublishedDate)
            {
                this.OverridePublishedDate = new DateTime();
                this.URL = url;
                this.BackupPath = path;
                this.NewPostsSince = newPostsSince;
                this.BlogTitle = blogTitleText;
                this.Blog = WorkingBlog;
                this.OverridePublishedDate = workingPublishedDate;
            }
        }

        public delegate DialogResult DisplayLoginDelegate(IWin32Window owner, ref BlogSetting Blog, ref string WorkingValue);

        public delegate void ProgressUpdateDelegate(int BatchSize, int BatchProgress, string LastSavedPost, string savedFilename);

        public delegate void StatusUpdateDelegate(string Message);

        public delegate void TotalDownloadedDelegate(int Downloaded);
    }
}

